import request from '@/config/axios'
import type { Room } from './types'

export const getRoomsListApi = (params: any): Promise<IResponse<IResData>> => {
  return request.get({ url: '/rooms', params })
}

export const createRoomsApi = (data: Partial<Room>): Promise<IResponse> => {
  return request.post({ url: '/rooms', data })
}

export const bulkCreateRoomsApi = (data: Room[]): Promise<IResponse> => {
  return request.post({ url: '/rooms/bulk', data })
}

export const updateRoomsApi = (id: string, data: Partial<Room>): Promise<IResponse> => {
  return request.put({ url: `/rooms/id/${id}`, data })
}

export const getRoomsDetailApi = (id: string): Promise<IResponse<Room>> => {
  return request.get({ url: `/rooms/id/${id}` })
}

export const delRoomsListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.delete({ url: `/rooms/id/${ids[0]}` })
}
